<?php

namespace app\models;

use yii\db\ActiveRecord;

class Customer extends ActiveRecord
{
    // 获取订单的信息
    public function getOrders()
    {
        //return $this->hasMany(Order::className(), ['customer_id' => 'id'])->asArray()->all();
        // 注程序会自动添加all()方法，因此去掉all()防止可能出现的问题
        return $this->hasMany(Order::className(), ['customer_id' => 'id'])->asArray();
    }
}